package demo02.demo2riji;

import java.util.ArrayList;
import java.util.Iterator;

public class foreach {
    public static void main(String[] args) {
        ArrayList<String>list=new ArrayList<>();
        list.add("ds");
        list.add("ds");
        list.add("ds");
        for (String s : list) {
            System.out.println(s+" ");

        }
        int[]arr={1,3,4,5,7};
        for (int i : arr) {
            System.out.println(i+" ");
        }
        Iterator<String>it=list.iterator();
        while (it.hasNext()){
            String s = it.next();
            System.out.println(s);
        }

    }
}
